<template>
  <div>
    <el-dialog :title="title" :visible.sync="dialogVisible" width="500px">
      <el-form class="demo-form-inline" label-width="80px">
        <el-form-item label="注销原因">
          <el-input v-model="data.logoutReason" />
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submit()">提 交</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import apiUser from '@/api/baseManager/user'
export default {
  name:'dialogLogout',
  data() {
    return {
      dialogVisible: false,
      title:'',
      data: { 
        id:'',
        userState:2,//状态
        logoutReason:'' //注销原因
      }
    }
  },
  methods: {
    //注销
    open(row) {
      this.data  = row
      this.title = "注销用户--"+row.userName
      apiUser.get(row.userId).then(res=>{
        let e = res.data.item;
        this.data = {
          userId : e.userId,
          userState:2,
          logoutReason : e.logoutReason
        }
      })
      this.dialogVisible = true
    },
    //提交
    submit() {
      apiUser.update(this.data).then(res=>{
        this.$parent.getList(); //刷新表格
        this.dialogVisible = false
      })
    }
  }
}
</script>

<style scoped>
</style>
